When you modify an old version of code, delete the future versions of code so that undo works as expected.