Fixed numerous issues in pyro.sort_tree

Fixed numerous issues in pyro.sort_tree, including:
- user defined classes (like 'no-nest') were being removed
- wrong icons were being set for all parents when dragging items with hidden children
- child icons didn't properly update when dragging/dropping items with children
- cookies weren't saved when dragging/dropping items
- cookies could save invalid states