fixed missing index on click event