More fixes and improvements