Fix for query string extraction