Validity check fix from previous commit