fix the sql script