         graphicsPath.commands = null;
         graphicsPath.data = null;
         
-
         // Always start by moving to drawX, drawY. Otherwise
         // the path will begin at the previous pen location
         // if it does not start with a MoveSegment.
         graphicsPath.moveTo(tx, ty);
-        var currentSubPathStartIndex:int = 0;
+        var lastMoveX:Number = tx;
+        var lastMoveY:Number = ty;
         
         for (var i:int = 0; i < segments.length; i++)
         {
             var segment:PathSegment = segments[i];
                     
             segment.draw(graphicsPath, tx,ty,sx,sy, (i > 0 ? segments[i - 1] : null));
-            
-            if (segment is CloseSegment)
+                        
+            if (segment is MoveSegment)
+            {
+                lastMoveX = segment.x;
+                lastMoveY = segment.y;
+            }
+            else if (segment is CloseSegment)
             {   
-                if (segments[currentSubPathStartIndex] is MoveSegment)
-                    graphicsPath.lineTo(tx + segments[currentSubPathStartIndex].x*sx, ty + segments[currentSubPathStartIndex].y*sy);
-                else
-                    graphicsPath.lineTo(tx, ty);
-                    
-                currentSubPathStartIndex = i+1;
+                graphicsPath.lineTo(tx + lastMoveX * sx, ty + lastMoveY * sy);    
             }
         }
     }

        var sx:Number = naturalBounds.width == 0 ? 1 : width / naturalBounds.width;
        var sy:Number = naturalBounds.height == 0 ? 1 : height / naturalBounds.height; 

        var currentSubPathStartIndex:int = 0;
        var prevSegment:PathSegment;
        var pathBBox:Rectangle;
        
        for (var i:int = 0; i < segments.length; i++)
        {
            var segment:PathSegment = segments[i];
            
            if (segment is CloseSegment)
            {   
                if (segments[currentSubPathStartIndex] is MoveSegment)
                    segment = new LineSegment(segments[currentSubPathStartIndex].x, segments[currentSubPathStartIndex].y);
                else
                    segment = new LineSegment();
                    
                currentSubPathStartIndex = i+1;
            }

            pathBBox = segment.getBoundingBox(prevSegment, sx, sy, m, pathBBox);


import flash.display.Graphics;
import flash.display.GraphicsPath;
import flash.display.Shape;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;

import mx.core.mx_internal;
import mx.utils.MatrixUtil;

import spark.primitives.pathSegments.CloseSegment;
import spark.primitives.pathSegments.CubicBezierSegment;
import spark.primitives.pathSegments.LineSegment;
import spark.primitives.pathSegments.MoveSegment;
import spark.primitives.pathSegments.PathSegment;
import spark.primitives.pathSegments.QuadraticBezierSegment;
import spark.primitives.supportClasses.FilledElement;


use namespace mx_internal;
