http redirection code, trying to fix them