Fixed inter-thread problems