Fix premature EOF issue #8