Fixed memory leak issue caused by not recognizing undefined correctly as a value in _events, Issue #1059
Merge commit '8a31908'