HHH-7910 Corrected thread checking logic