final fixes and improvements for security auth