Fixes for build with mb2 and compilation with gcc4.8.3