modify update_state method, update test