uploading: make sure to cast to uint64 to avoid integer overflow