fixed loging in and redirection