tweaks to improve enter/leave event handling - fixes at least some crashes caused by this stuff