Fixing redirect loop (hopefully)