bug fixes for crashed threads