XD-1616 - Code review: fix EOF issues