fixes with optimization