Fix copy pointer bug