Security fix, and improvements