do optimize before save