Improves `object` validation to fix #338.
Merge pull request #339 from LearningLocker/issue-338

Improves `object` validation to fix #338.