fixed redirect loop error