Index bug fix