Set objectId only when needed