Fix "Cannot read property of null/undefined".
Merge pull request #1026 from TadeasKriz/fix/undefined-this

Fix "Cannot read property of null/undefined".