Fixed build error on gcc4.8 and warnings for clang (travis build).