add checking if database loaded