bug fix after database structure change