Fix looping issue when computing last usages of fields

- A missing condition could cause an infinite loop
- Various clean-ups