Fixed a few bugs. Deleting tables at the end works properly now.