fix a logical error