Minor adjustment to validity check