Create objects before using them.
Fix permalinks for LAW_LONG_URLS
Don't lookup dictionary structures that clearly do not exist.
Use prepared statements for permalink deleting so that we can automagically reconnect.
Removing bad code that breaks imports.