Update tools.js -fix to battle crash
Merge pull request #45 from Aananth31/patch-5

Update tools.js -fix to battle crash