Fixes for gcc4.6 and newer compilers