Fixed problem with multiple identical states added to the history