fix endless redirect loop