fixed to no longer include missing indices at the end of the file