Cast fixes for C++11.