Fix indexing issues.