Fixing bug : checking if database is not empty before updatingCharts()