added another static_cast to make g++-4.8 happy