Feature #3427: Fix a array access bug in event manager