Fixed undo crash, Added debug call and test routine.

Signed-off-by: Lennard Wasserthal <Wasserthal@nefkom.net>