read files correctly