Some code got committed to stable branches that relied on a new API that was in master only. This fixes it to use the old API.
This commit build's on Jean-Michel's work, tidying up a few lose ends.