Add check for null objectId