Fix exception thrown on invalid login