xml constraint
fixed logic errors