Fixed a bug in duplicate.