set stdout/stdin binary mode for windows, add some debugging