Added try-catch to login