a bug fix for eof.
error handling.
adding %S.