json-friendly debug messages. fix #659