fixes some problems with dataset queries