fixes to flat command