Fix category order + nesting Closes #2226.