optimize of #542