Couple of fixes and improvements