Fix S3 directory location infinite loop
Merge pull request #1725 from promisedlandt/s3_location_fix

Fix S3 directory location infinite loop