Fixed two NPEs in tests