Set mime_type whenever possible.
Bugfixes.