minor SQL adjustments