create tree of category fix some bugs