reworking contact ids, fixing #7921