Update backref.py

check for uid before adding reference