Added fix to get the index of the email item.