mock: fixed undefined conditions in queries