Merge changes from iainrb/devel for release 3.1