Revert "some small bug fixes"

This reverts commit 0136857a3c2c83c7f8111f171dd87cda10008097.