bugfixes to the new api dbquery