Fixed bug where the query result was not initialised for empty queries.