Even more SQL fixes.