Fixing error in javaScript.