Fix invalid anonymous definition detection