Fixed bug causing redirecting to not work