backport changes to C