Fix bug in useless checks prune