Query with wrong results using rules