A couple of fixes and improvements