Bug fix for file reading