optimizations and errors