Fix OOB access in CM_EdgePlaneNum