Bug fixes, and teardown enhancements