fix inverted coordinates