Fixed problem with threads.