S3 API support fixes

Ignore this pull - I submitted a newer one with just 1 commit.