set state bug workaround