Revert "Bug fixes"

This reverts commit e7b7d904752fc8fb0789b198c50572a003680d21.