addressed Vinayak's comments
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/ATypeHierarchy.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/ATypeHierarchy.java
index c4eef6f..254a904 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/ATypeHierarchy.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/ATypeHierarchy.java
@@ -50,20 +50,20 @@
     }
 
     public static void addPromotionRule(ATypeTag type1, ATypeTag type2, ITypePromoteComputer promoteComputer) {
-        int index = (type1.serialize() - 1) * ATypeTag.TYPE_COUNT + (type2.serialize() - 1);
+        int index = type1.ordinal() * ATypeTag.TYPE_COUNT + type2.ordinal();
         typeHierachyMap.set(index);
         promoteComputerMap.put(index, promoteComputer);
     }
 
     public static ITypePromoteComputer getTypePromoteComputer(ATypeTag type1, ATypeTag type2) {
         if (canPromote(type1, type2)) {
-            return promoteComputerMap.get((type1.serialize() - 1) * ATypeTag.TYPE_COUNT + (type2.serialize() - 1));
+            return promoteComputerMap.get(type1.ordinal() * ATypeTag.TYPE_COUNT + type2.ordinal());
         }
         return null;
     }
 
     public static boolean canPromote(ATypeTag type1, ATypeTag type2) {
-        return typeHierachyMap.get((type1.serialize() - 1) * ATypeTag.TYPE_COUNT + (type2.serialize() - 1));
+        return typeHierachyMap.get(type1.ordinal() * ATypeTag.TYPE_COUNT + type2.ordinal());
     }
 
     public static boolean isCompatible(ATypeTag type1, ATypeTag type2) {
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/AbstractIntegerTypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/AbstractIntegerTypePromoteComputer.java
index b7c1885..12bfaf4 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/AbstractIntegerTypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/AbstractIntegerTypePromoteComputer.java
@@ -24,11 +24,13 @@
     public void promoteIntegerType(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue,
             ATypeTag targetType, int targetTypeLength) throws IOException {
         storageForPromotedValue.getDataOutput().writeByte(targetType.serialize());
-        int copyStart = (length < targetTypeLength) ? start : start + length - targetTypeLength;
-        int copyLength = start + length - copyStart;
-        for (int i = 0; i < targetTypeLength - copyLength; i++) {
-            storageForPromotedValue.getDataOutput().writeByte(0);
+        long num = 0;
+        for (int i = start; i < start + length; i++) {
+            num += (data[i] & 0xff) << ((length - 1 - (i - start)) * 8);
         }
-        storageForPromotedValue.getDataOutput().write(data, copyStart, copyLength);
+
+        for (int i = targetTypeLength - 1; i >= 0; i--) {
+            storageForPromotedValue.getDataOutput().writeByte((byte)((num >>> (i * 8)) & 0xFF));
+        }
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToDoubleTypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToDoubleTypePromoteComputer.java
index a4b231c..014dc2a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToDoubleTypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToDoubleTypePromoteComputer.java
@@ -32,11 +32,11 @@
     public void promote(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue)
             throws IOException {
         storageForPromotedValue.getDataOutput().writeByte(ATypeTag.DOUBLE.serialize());
-        Long val = 0L;
+        long val = 0L;
         for (int i = 0; i < length; i++) {
             val += ((long)(data[start + i] & 0xff)) << (8 * (length - 1 - i));
         }
-        DoubleSerializerDeserializer.INSTANCE.serialize(val.doubleValue(), storageForPromotedValue.getDataOutput());
+        DoubleSerializerDeserializer.INSTANCE.serialize(Double.valueOf(val), storageForPromotedValue.getDataOutput());
     }
 
 }