Fix bug in $emit/$on and prepare for desert-implementation.