[BUGFIX] indexOf eventlistener performance improvement

Fixes #3917