fixed error when saving - replaced safefs with fs