fixing another severe bug in sql patches