Fixed some issues found while trying to compile with MSVC2012.