found a bug in query() caused by sweet js syntax

added tests to cover