Fixed bug in js where wrong variable name was used.