Fix infinite loop and stale value when reading multiple times