fix bad state