fixed a bug with undo -> reset