Some more sql changes