Fix mistakes in object validation code.