Fix gcc-4.6 and gcc-4.7 compiling errors