some small optimizations