more query fixes

Signed-off-by: Alexander Skjolden <alex@plastboks.net>