added s3 storage and fixed bugs