fixed clang++ and g++ c++11 "narrowing convertion" compilation errors