fixed database bug and complete whot to call