Bug fix for wrong variable used in transform