Statistics: better handling of db probelms