Corrected isValid