A solution to ghost threads and silent exceptions