Corrected validation for elements