Fixed redirect issues when logging in and registering