Fixed NPE and did event clean up fixing