hw 5 errors with index