Fixed a problem with restoring the selected range twice.