query tweaks; fix #460