Added validation when the provided element is not valid