Fixes in file reading