new database function and fixed diaryentrymood fetcher