Fix NPE

I fix an NPE which appeared in a functional test.