bug in functions.js: Cannot read property 'replace' of undefined

Signed-off-by: Marc Delisle <marc@infomarc.info>