better mimetype handling