corrected a bug where x and y where inverted