small fixes to reconstituted SharedPtr<> code (element_type and fixed dynamic_pointer_cast)