several small improvements to queries & related