Changed conversion implementation to take care of primitive type conversions