handle LASTBATCH properly for S3