fix code 307 redirect handling