fixing redirect loop. tests work now :/