cleanup fixes to sql and removed accidental copy