Hey minidavid -- glad you enjoyed the game.
As for your question -- TIC-80 does not provide much structure as an "engine" so there is no "correct" way to implement undo. It very much depends on how you've implemented it in your game.
As a guess, perhaps you're undoing on button hold rather than button press so that it's triggering multiple times very fast?