fix for doubly open connection
fix for wrong db directory