this should fix the query properly.

Signed-off-by: Antes <antes@simplemachines.org>