Lots of tiny fixes