Integrate EOF check.

Issue #37.