Revert "Various fixes"

This reverts commit 8a7c2a2e5bba75d200f23ad1be79058b40fb6501.