HCSVLAB-364: Fixed bug when using more complex queries.