trying to fix the distance transform