Handle EOF with retry

Should close this issue #13