Fix group ordering. Fixes #574