Fix javascript code based on static analysis feedback