Fixed some state issues