D6 backports of d7 patches for fatal errors where functions have been removed