added minor error checking to login method