a couple of fixes and improvements