Prevent response to be sent twice in util.js