fixed redirect loop