Small optimization in event callbacks.