Tweak module auth
various fixes and improvements for session handling