Revert "bug fixes"

This reverts commit c41fee75619f4d8be0d3075239f159abda18638d.