shell: Fix tests for previous changes, and remove a race with NM.