fixed some file saving issue