Fix up sql insert queries