At the start of MCImage::save - you'll need to do:
```
if (MCStringIsEmpty(filename))
  flags |= F_HAS_FILENAME;
else
  flags &= ~F_HAS_FILENAME;
```
This ensures the flags field F_HAS_FILENAME (only used for serialization) will be in sync with the current setting of the filename instance var.