Contacts does not allow apple Events

On both Ventura 13 and beta 13.1 this failed but in Monterey it works fine. I tried tccutil reset AddressBook and tccutil reset AppleEvents and they were both successful. I restarted and tried again. I executed count of groups again and I was asked to allow Contacts to be controlled. I answered yes and then I got Not authorised

Thanks for your help

tell application "Contacts"
	count of groups
end tell

error “Not authorised to send Apple events to Contacts.” number -1743