Fixed login redirect loop bug