Thanks a lot for the answers!
I'm really sorry... but... I gave up.

I've rewritten the code completely into records until it was not too far away from the beginning...
Now everything is working flawlessly including undo and future 'raw file save'.
Sorry for disturbing everybody... This information was really very useful. I hope I'll find use for it later, as the Castle Game Engine is OO...