Fix db null when not caching