fixed a lot of data base issues