Changes to make segmentation work on windows