The following fixes have only been applyed to branche 1.3: 8f430673 5c61ecf1
We need to cherrypick them to master