A small amendment to the method was required to correct this.
Roedd angen newid bach i'r dull er mwyn cywiro hyn.