fix incorrect indexing used to generate store to double external arrays