fix javascript code