Validation fix. Fixes #5322
Merge pull request #5325 from juztas/validation_fix

Validation part fix. Fixes #5322