Adding more robustness to validate function
Merge pull request #495 from psav/validate_robust

Adding more robustness to validate function