Revert "Revert "fix build errors using gcc-4.7""

This reverts commit 0d1ca071d3c609bc4994f7e4bdb6dc497e48108c.