Fix event emitter issue and add some tests
0.1.2