Fix NH-3316

Tests covering NH3316
Fix some other bad unit tests