Fix bugfix in S3 check function