diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java
index 9ce9b24..ffbbd64 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java
@@ -15,6 +15,9 @@
 
 package edu.uci.ics.asterix.om.types;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * There is a unique tag for each primitive type and for each kind of
  * non-primitive type in the object model.
@@ -72,6 +75,20 @@
         return value;
     }
 
-    public final static int TYPE_COUNT = ATypeTag.values().length;
+    public static final int TYPE_COUNT = ATypeTag.values().length;
+
+    public static final ATypeTag[] VALUE_TYPE_MAPPING;
+
+    static {
+        List<ATypeTag> typeList = new ArrayList<>();
+        for (ATypeTag tt : values()) {
+            int index = tt.value;
+            while (typeList.size() <= index) {
+                typeList.add(null);
+            }
+            typeList.set(index, tt);
+        }
+        VALUE_TYPE_MAPPING = typeList.toArray(new ATypeTag[typeList.size()]);
+    }
 
 }
\ No newline at end of file
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
index 08105a2..7cf588e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
@@ -16,7 +16,16 @@
 
 import java.io.DataOutput;
 import java.io.IOException;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
 
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
@@ -32,13 +41,12 @@
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class AStringConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
-    private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
         public IFunctionDescriptor createFunctionDescriptor() {
             return new AStringConstructorDescriptor();
@@ -52,34 +60,109 @@
 
             @Override
             public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+                try {
+                    return new ICopyEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
-                    private String errorMessage = "This can not be an instance of string";
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
+                        private DataOutput out = output.getDataOutput();
+                        private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
+                        private ByteArrayAccessibleOutputStream baaos = new ByteArrayAccessibleOutputStream();
+                        private PrintStream ps = new PrintStream(baaos, false, "UTF-8");
+                        private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                        @SuppressWarnings("unchecked")
+                        private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+                                .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                        @Override
+                        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                            try {
+                                outInput.reset();
+                                eval.evaluate(tuple);
+                                byte[] serString = outInput.getByteArray();
 
-                        try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == SER_STRING_TYPE_TAG) {
-                                out.write(outInput.getByteArray(), outInput.getStartOffset(), outInput.getLength());
-                            } else if (serString[0] == SER_NULL_TYPE_TAG)
-                                nullSerde.serialize(ANull.NULL, out);
-                            else
-                                throw new AlgebricksException(errorMessage);
-                        } catch (IOException e1) {
-                            throw new AlgebricksException(errorMessage);
+                                ATypeTag tt = ATypeTag.VALUE_TYPE_MAPPING[serString[0]];
+                                if (tt == ATypeTag.NULL) {
+                                    nullSerde.serialize(ANull.NULL, out);
+                                } else if (tt == ATypeTag.STRING) {
+                                    out.write(outInput.getByteArray(), outInput.getStartOffset(), outInput.getLength());
+                                } else {
+                                    baaos.write(0);
+                                    baaos.write(0);
+                                    switch (tt) {
+                                        case INT8: {
+                                            int i = AInt8SerializerDeserializer.getByte(outInput.getByteArray(), 1);
+                                            ps.print(i);
+                                            break;
+                                        }
+                                        case INT16: {
+                                            int i = AInt16SerializerDeserializer.getShort(outInput.getByteArray(), 1);
+                                            ps.print(i);
+                                            break;
+                                        }
+                                        case INT32: {
+                                            int i = AInt32SerializerDeserializer.getInt(outInput.getByteArray(), 1);
+                                            ps.print(i);
+                                            break;
+                                        }
+                                        case INT64: {
+                                            long l = AInt64SerializerDeserializer.getLong(outInput.getByteArray(), 1);
+                                            ps.print(l);
+                                            break;
+                                        }
+                                        case DOUBLE: {
+                                            double d = ADoubleSerializerDeserializer.getDouble(outInput.getByteArray(),
+                                                    1);
+                                            ps.print(d);
+                                            break;
+                                        }
+                                        case FLOAT: {
+                                            float f = AFloatSerializerDeserializer.getFloat(outInput.getByteArray(), 1);
+                                            ps.print(f);
+                                            break;
+                                        }
+                                        case BOOLEAN: {
+                                            boolean b = ABooleanSerializerDeserializer.getBoolean(
+                                                    outInput.getByteArray(), 1);
+                                            ps.print(b);
+                                            break;
+                                        }
+
+                                        // NotYetImplemented
+                                        case CIRCLE:
+                                        case DATE:
+                                        case DATETIME:
+                                        case LINE:
+                                        case TIME:
+                                        case DURATION:
+                                        case YEARMONTHDURATION:
+                                        case DAYTIMEDURATION:
+                                        case INTERVAL:
+                                        case ORDEREDLIST:
+                                        case POINT:
+                                        case POINT3D:
+                                        case RECTANGLE:
+                                        case POLYGON:
+                                        case RECORD:
+                                        case UNORDEREDLIST:
+                                        case UUID:
+                                        default:
+                                            throw new AlgebricksException("string of " + tt + " not supported");
+                                    }
+                                    ps.flush();
+                                    byte[] tmpStrBytes = baaos.getByteArray();
+                                    int utfLen = baaos.size() - 2;
+                                    tmpStrBytes[0] = (byte) ((utfLen >>> 8) & 0xFF);
+                                    tmpStrBytes[1] = (byte) ((utfLen >>> 0) & 0xFF);
+                                    out.write(ATypeTag.STRING.serialize());
+                                    out.write(tmpStrBytes);
+                                }
+                            } catch (IOException e) {
+                                throw new AlgebricksException(e);
+                            }
                         }
-                    }
-                };
+                    };
+                } catch (UnsupportedEncodingException e) {
+                    throw new AlgebricksException(e);
+                }
             }
         };
     }
