type validation added, makes the validator more rebust