change int isize to uint64_t to avoid overflow