fix bad segments