Changed the check for existing thread