Added db existence checking
General fixes