minor bugfixes related to new sql model