Stop executing broken queries

Change-Id: Id00e48e8f8efd0984e164186ac0e943fefdec1d6