DB/SQL: Misc fixes #2