Add error event emmitting