Fixed code which assumed db .get was returning dict instead of list