finished distance transform; fixed warnings