Fix up a couple of NPEs that happen on edge cases