Qubole s3 optimization

Fixes minor bugs in S3 optimization.