Added exception handling when reading file as string.