Solve legacy problem with clear operation (coredump with running threads)