removed cgi.escape() as it was causing unexpected behaviour on some urls