code fixes for MSVC 2012 compiler support