Fixed s3 upload related bugs.