fix bugs for updateState