fix labeling logic errors