handle empty database case