Bugfix for query on where and in