Index not being passed to template