Fixed replace_indices to use new Theme