Fix logic error in util.js