Some compile fixes for MSVC and some warning fixes

We could live with these warnings for 0.11 release, but the compile fixes are needed.