Fix issues with .doc, .docx and .rtf files. Also fix 500 error on front page