revert some previous changes and add another bugfix