Fix Javascript code