Fix some issues with reading from files.