Fixed a JavaScript error with a function.