Changed urlencode call to respect URL query parameters dictionaries created by parse_qs().