Do not exit from loop in ExpandScalar if parts of it is still expandable

Close #3144