fixing and optimizing events with tags