Fixed some socket/thread issues.