Check for object before setting id