backport some util.h updates