bug fix after changing database stucture