Fixing bug in history feature