winpr-environment fix and winpr-thread fixes