Fix bug with profiler events not working properly