Fixed file load bugs and bad trim code

Fixed the index loading code bug where read lines from index files would
be trimmed incorrectly and causing file not found errors.