cherrypick utils.js change from  a4fb73b6d90bed5701e3a3672b6ee4a9da78d60a