Fixed GCC 4.8 and 4.9 ICEs and compilation errors.