removing bugs for distance map