fix validation that would never get executed

I've fixed some logic that seems to never get executed.

I'm sending this fix as a pull request so that it can get reviewed.