Fix variable creation in Javascript code