a few small optimizations