changed the condition for isValid; an undef value part is not wrong anymore(you might query for it)