Fixing error when trying to validate a model