This generates warnings with MSVC. Similar typecast was already done in other cases, so think it's all fine.