fixed casting issue caught when using clang