Fix document mimetype detection