undefined state bug