Add null checks to Permutations