better error reporting in utils.js