changed toSvg method