Use pk instead of id

Also don't assume None means the same as 0.