Fix history states bug