Fixed Linux threading issues.