Make thread pool more robust