Revert "Bug fixes"

This reverts commit 9f0aedf714aab02552519a0ea0959a0d98f73dc4.