Revert "Bug fixes"

This reverts commit 755b486aa9bc09b1632316fd53e5fc549866f439.
Revert 755b486..78f57b4

This rolls back to commit 755b486aa9bc09b1632316fd53e5fc549866f439.