Better handling for EOF case