Some optimizer fixes to support splits.