Fixed optimizer updating