ref is undefined for some events
Merge pull request #12 from ralphtheninja/master

ref is undefined for some events