updated for s3 support