Fixed reading from stdin.