Accidently Claimed a Dependent

I accidently claimed my son on my tax return (not sure how it happened)  Now my ex husband cant claim him as per our agreement.    I will probably have to amend my return for 2020 when its available to do so or get audited.  However, because I claimed him I received his stimulus.   If I amend what will happen about the stimulus.   I wouldn't mind just handing it over to my ex but will the govt take it back after the amendment?