Fixed login and registration bugs