Fix to bug in Validate function