Fixes, improvements to authentication