fix nil pointer in teardown