Fix various issues with login