Bug fix when cutting duplicates