fixed bug when reading near EOF
Merge branch 'dev'