Fixed issue with empty queries