fixed bug in viewFile()