Improved mime type handling