some Apache optimizations, and other fixes