fixed insert state bug