Handle locked threads better