fix for HADOOP-3733

tested with:
- unit tests included in patch
- hadoop fs -ls ...
- distcp to/from s3:// and s3n://