So update: I gave it unlimited undos in the patch, and got rid of those bugs. Thanks again for your feedback!