Allow arbitrary cast of DynamicDictionaryValue

Casting of DynamicDictionaryValue was coded to fail when casting to a
reference type. This is fixed.