more sql tweaks