Proper fix for category assignments sorting