Fixed some of the copying to support global sharing