Fix indexing bug when generating require list for autoload().