changed login to return error message instead of crashing.