2.7 backport

Small changes for 2.7 backport.
Should we merge into another branch than master ?