fix erroneous detection of data end
Merge pull request #2 from a-zwei/master

fix for erroneous detection of data end