modified lib/js/util.js