fix possible wrong cast to 32-bit unsigned