bug fix for x and y offset