Fixed the event listeners for login and register