Handled the cases where the key could not be retrieved from the database.