Fix everything
Merge pull request #4 from STRd6/patch-1

Fix infinite loop and stale value when reading multiple times