Revert "bug fixes"

This reverts commit d562360748a0e6dc581c523c58df68172aa51301.