Fixed saveAs empty file bug