change some more sql around