Undo is changing link data

If I do Ctrl+Z (Undo) operation on canvas that time linkArray is getting updated with different from and to values. Is there another way to regenerate linkArray which was earlier before Undo operation? As of now when I do Undo operation, from and to values are getting changed with some random negative value.

Could you please show the link data before and after the undo, and can you please describe what happened in the original transaction that is being undone?