Improves `object` validation to fix #338.

#338.