fix for creating the tree view from a foreign key