segmentation now working but filtering causes crash