added static linking to CRT on windows, and fixed some other errors