fix a bit.
tool: add error messages.
bugfix: tool: wrong fd.