added static_cast to make g++-4.8 happy