Some fixes of DB