Update lastEvents if a widget exists.
Merge pull request #303 from boxiong/master

Update lastEvents only if a widget exists.