Update tools.js -fix to battle crash