fixes #4 - stream position not properly returned