fixed some state changing