Fixed a bug in setState