fixed corrupted file issue when saving on server