Handle events that are emitted before .on() returns

Fixes: #1