Treeview undefined error is partially fixed