Solution to ghost threads and silent exceptions