Replace current/buggy implementation by one based on bufio.Scanner.