Fixes #297
Fixes #393. Fixes another issue where loop edges get deleted twice.
Fixes #393