Fix bug when creating treepanel