event emit works but message is not in the scope