mirror of mmseg; plus some fixes