Fix indices in formula