Various bug fixes on the s3 driver