Fix event scope and add a test.