Fixed bug in getMatchedELementIndex