Correct DB check. Fix #373