Fix NRE in the tests