changed way how files in temp directory are read, to avoid issues with file names in different encodings.