small optimizations on dll events