fix re-ordering of groups