Fixed bug with storing history.