Fix compile under Windows, minor cleanups
Fix some warnings