Correcting general bugs and improving state changes