Added checks for null db entries