Fixed login error handling bug