added mimetype handling