Optimization and fix