solving issue of hanging worker threads