Guard against TaskMetrics NPE + Fix tests