fixed NPE when the custom event gets called.