Revert "Bug fixes"

This reverts commit 18d668477f16f516d4b6fe0332f2e84d323ddc89.