Ensure that nulls/gaps in nodes array are skipped