throw exception when EOF