Fix bugs in BaseTree.insertChild