                     {
                         case TypeCache.BOOLEAN:
                         {
-                            result = Comparator.numericCompare(a, b);
+                            result = Comparator.numericCompare(Number(a), Number(b));
                             break;
                         }
 
                         case TypeCache.NUMBER:
                         {
-                            result = Comparator.numericCompare(a, b);
+                            result = Comparator.numericCompare(a as Number, b as Number);
                             break;
                         }
 
                         case TypeCache.STRING:
                         {
-                            result = Comparator.stringCompare(a, b, caseInsensitive);
+                            result = Comparator.stringCompare(a as String, b as String, caseInsensitive);
                             break;
                         }
 
                         case TypeCache.DATE:
                         {
-                            result = Comparator.dateCompare(a, b);
+                            result = Comparator.dateCompare(a as Date, b as Date);
                             break;
                         }
 
                         case TypeCache.XML_TYPE:
                         {
-                            result = Comparator.xmlCompare(a, b, numeric, caseInsensitive);
+                            result = Comparator.xmlCompare(a as XML, b as XML, numeric, caseInsensitive);
                             break;
                         }
                         default:

        return result;
    }

    /**
     * Pull the values out fo the XML object, then compare
     * using the string or numeric comparator depending
     * on the numeric flag.
     */
    public static function xmlCompare(a:Object, b:Object, numeric:Boolean, caseInsensitive:Boolean):int
    {
        var sa:String;
        try

        return 0;
    }

    public static function dateCompare(fa:Date, fb:Date):int
    {
        var na:Number = fa.getTime();
        var nb:Number = fb.getTime();

