added mimetype checking