Fixes for the to_tensor() function. The tensor was completely wrong.
Authored by: bugman 2008-07-09
Parent: [r6894]
Child: [r6896]