Fixing query logic

Signed-off-by: shyeon.kim <shyeon.kim@scipi.net>