some fixes (reorganizeMain)