The CountedPtr seems to cast correctly but is still having some runtime issues when casting around diamonds, it seems that it is being initialized with a 0 somehow.