Fixing bug causing history to break after being cleared