fixed all saving and reading from db