fix weird polygon bug
mild efficiency improvement