some small performance optimizations