Revert "Bug fixes"

This reverts commit c112f500f56354655ddc1ee37b7f90e20ad387ff.