Fixing warnings and safety issues in JavaScript