Made login more error resistant.