another batch of very safe optimizations