       
       // note relocate
       var count = 0
-      for _ in noteParent.index..<noteChild.index {
+      for _ in noteParent.index..<noteChildIndex {
         let note = self.notes.removeAtIndex(noteParent.index+count)
         self.notes.insert(note, atIndex: noteInsertIndex+count)
         count += 1

      }
      
      // note relocate
      for _ in noteParent.index..<noteChild.index {
        let note = self.notes.removeAtIndex(noteParent.index)
        self.notes.insert(note, atIndex: noteInsertIndex-1)
      }

            self.uncollapse(indexPath: displayIndexPath, tableView: tableView) {
              // save
              Notebook.set(data: self)
              print(self)
            }
          }
        }
