fix bugs for addState