Memory fix for events (with slight degradation in performance)