Fix cleanup with RAW SQL