After you file

To fix it you have to file 1040-x Amendment No.2 that includes a corrected Schedule D and a reduction of AGI on 1040-X line 1 Col C of $3,005 less than the amount in Line 1 Col C of 1040-X No.1 

The remaining lines follow from the tax calculated and the other amounts -- e.g. Line 18 refund -- as adjusted by IRS.

 

@Bob in Plano