Port a couple of changes from 3.1.