 			throw DBError.queryFailed
 		}
 		var wspaces: [Workspace] = []
+		assert(results.rowCount >= 0)
 		for row in 0..<results.rowCount {
 			let wspace = try workspace(from: results, row: row)
 			wspaces.append(wspace)

			throw ModelError.dbError
		}
		projects.forEach { wspaceDict[$0.id] = [] }
		for row in 0..<result.rowCount {
			let wspace = try workspace(from: result, row: row)
			wspaceDict[wspace.projectId]!.append(wspace)

			logger.warning("error fetching workspace files: \(result.errorMessage)")
			throw ModelError.dbError
		}
		assert(result.rowCount >= 0)
		for row in 0..<fresult.rowCount {
			let aFile = try file(from: fresult, row: row)
			guard fileDict[aFile.wspaceId] != nil else {
