Fix optimizer errors