Login Redirection Fix #231

fixes #239, #218, #247