add EOS frame; fix a bug of calculating readSize