fix for some thread wait scenarios hanging