Risolti alcuni bug del thread