bug while thread spawning fixed