Category fixes

Bugfix for category tree ordering / nesting levels
Merge remote-tracking branch 'origin/master' into Templates