Fixed small mistakes.
Fixed small mistake in tensorinv function.