Revert "Various fixes"

This reverts commit 307403d4a5440ca74c71523e2d0371e90819a277.