Bug fix in model validation