refactored/fixed incorrect login redirect