Some optimizer fixes.