fix bug with converting position to coordinates