fixes a bug in the coordinate transformation, now it works