Fix deadlock when create database