fixing redirect issue

can't use variable name location because it replaces window.location