Fix EOF and no input cases