only update the statefile if the data changed