Fix how index is passed