thread problems fixed

thread problems fixed