Fixed NULL value

Fixed foreign key is NULL value can't get object from method toDict