sql: different fixes