SQL upgrade fixed