[0.1-2] Fix thread problems and change to C