Fixes for warnings and compilation errors on Visual Studio 2012