Added automatic detection of owner_id.