Validation fix. Fixes #5322