Fix delegated events

Many, many fixes. Delegated events now work correctly with several children.