change fork to thread due to crashes in MS Windows 7