more sql fixes2