Other fixes - use shared_ptr the right way