Fixed the transform function