CM fix SQL scripts