Various bits of refactorings and fixes broke abi, so better ensure it is reflected in the libraries (cherry picked from commit 185d4be0)