fixed AssertionError on shutdown