Fixing broken MySQL scripts