fixed query problem

Signed-off-by: Tom Everett <tome@criticalmass.com>