changed the order in which tables are deleted