fixed a problem with generating thumbnail of a document.