fixing bugs and remaking db