file segmentation, still buggy