Fixed types for DynamicObject::__name and DynamicObject::_type.
Throw exception in Utility::ToDouble/Utility::ToLong

Fixes #3617