Backport of 1a07976f. A new struct and a set of overloads are added to keep backward compatibility with 9.3 release.