Fix insertAtEnd at root level.