Some minor fixes and improvements