fixed null db bug