fix array size bug in segmentation module