small optimizations

small optimizations