Fixing xml validate function