Merge EOF patch (bug #1860)