validity check was wrong