Fix a bug caused by the previous commit

WHERE check code was removed by mistake.