Fixed a few issues with reading the files