small patch in functions.js