Enable SQL debugging. Fix post select bug