Fixes to expanding and collapsing categories