A few more fixes and improvements