Windows compile

A couple of fixes aiding compilation with MS Visual C.