fixed bug with tool toJSON method