Get rid of temp variable.
Fix conflicts, merge 4.0 branch.