[tools] now properly handles stdin

Should fix Issue #197