fix bug where new node is inserted inside a file