Fix manual sorting switching and detection of group mode.