fix plugin teardown bug