Part 2 of the backport

This does break the compiling, so need to dig deeper