Added support for objects that implement __toString().