Correct database exist check + escape every call which can fail otherwise