Something's wrong with the Undo function

Hi,
I believe there is something wrong with my "undo" button and its function. When I click on it, it shows not the last action but many actions ago, that doesn't help with my problem. I think it ceased to update my actions. Any clue how to fix this?
Thanks in advance.
Comments
What program are you using?