move to lib/util.js