Fix debug errors when fail to connect to database