fix sql patches