Fix document mimetype detection some more