fixed more thread problems