More sql fixes.