Use correct types to enable > 2G support, based on a patch from