Fix saving of media files, fixes #470