fixed user registration error and redirection to homepage when logging in