(library) Fix tree item expansion in some case