add a validity check that was missed, fixing a crash on the