Fix class cast on DynamicObjectBuilder