Index: /branches/end_stage/ippTools/src/pxtools.h
===================================================================
--- /branches/end_stage/ippTools/src/pxtools.h	(revision 16142)
+++ /branches/end_stage/ippTools/src/pxtools.h	(revision 16143)
@@ -114,5 +114,5 @@
     } \
  \
-    if (required && (var != max)) { \
+    if (required && (var == max)) { \
         psError(PS_ERR_UNKNOWN, true, "%s is required", key); \
         return ret; \
@@ -170,4 +170,19 @@
 
 #define PXOPT_COPY_PRIMITIVE(from, to, type, suffix, oldname, newname, comment) \
+{ \
+    bool status = false; \
+    type var = psMetadataLookup##suffix(&status, from, oldname); \
+    if (!status) { \
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for " oldname); \
+        return false; \
+    } \
+    if (!psMetadataAdd##suffix(to, PS_LIST_TAIL, newname, PS_META_DUPLICATE_OK, comment, var)) { \
+        psError(PS_ERR_UNKNOWN, false, "failed to add item " newname); \
+        psFree(to); \
+        return false; \
+    } \
+}
+
+#define PXOPT_COPY_V(from, to, type, suffix, oldname, newname, comment) \
 { \
     bool status = false; \
@@ -183,9 +198,6 @@
             return false; \
         } \
-    } \
-}
-
-#define PXOPT_COPY_V(from, to, type, suffix, oldname, newname, comment) \
-    PXOPT_COPY_PRIMITIVE(from, to, type*, suffix, oldname, newname, comment) \
+    }\
+}
 
 #define PXOPT_COPY_F(from, to, type, oldname, newname, comment) \
@@ -213,8 +225,26 @@
 
 #define PXOPT_COPY_TIME(from, to, oldname, newname, comment) \
-  PXOPT_COPY_V(from, to, psTime, Time, oldname, newname, comment)
+  PXOPT_COPY_V(from, to, psTime *, Time, oldname, newname, comment)
 
 #define PXOPT_COPY_STR(from, to, oldname, newname, comment) \
-  PXOPT_COPY_PRIMITIVE(from, to, psString, Str, oldname, newname, comment)
+  PXOPT_COPY_V(from, to, psString, Str, oldname, newname, comment)
+
+#define PXOPT_COPY_S16(from, to, oldname, newname, comment) \
+  PXOPT_COPY_PRIMITIVE(from, to, psS16, S16, oldname, newname, comment)
+
+#define PXOPT_COPY_S32(from, to, oldname, newname, comment) \
+  PXOPT_COPY_PRIMITIVE(from, to, psS32, S32, oldname, newname, comment)
+
+#define PXOPT_COPY_S64(from, to, oldname, newname, comment) \
+  PXOPT_COPY_PRIMITIVE(from, to, psS64, S64, oldname, newname, comment)
+
+#define PXOPT_COPY_U16(from, to, oldname, newname, comment) \
+  PXOPT_COPY_PRIMITIVE(from, to, psU16, U16, oldname, newname, comment)
+
+#define PXOPT_COPY_U32(from, to, oldname, newname, comment) \
+  PXOPT_COPY_PRIMITIVE(from, to, psU32, U32, oldname, newname, comment)
+
+#define PXOPT_COPY_U64(from, to, oldname, newname, comment) \
+  PXOPT_COPY_PRIMITIVE(from, to, psU64, U64, oldname, newname, comment)
 
 #endif // PXTOOLS_H
