State update bug