fixed bug with pregrouping