fix several compilation errors with Visual C++ 2013
simplify max_sizeof
more workarounds for missing C++ features in VC++ 2013