Fix for thread joining