When using preProcessNodes within foreach, ensure that updates are handled correctly