Fixed login problems and exception handling.