fix history up/down bug (issue #1751)