a few minor optimizations