Correction to make code work when pk is '0' (not null)

When the pk is 0 the edit does not work, so a correction is needed.