Fix is_primary handling