Fixed db problems 1