Fixed issue when req.url is incorrect, e.g. /search=foo&debug=whatever