Smoothing of flat surfaces