Some small fixes in event dispatcher