sql error fix to last rev