Fixed bug with xoffset and yoffset