Better error messages in tools.js