Bug fix for index