Fixed thread problem.