Update database detection function
Merge branch 'dev'
Fix database error