Bug fix on indexing memories