Fix __set_state bug