Fix off-by-one in S3