remove un-needed check
hanlde end of stream case