slightly more stable SQL queries