fix a couple small issues with query prefixing
add prefix tests