Fixed toTensor/fromTensor.