Additional exception handling
Made login case insensitive
fixed small logic error