Fixed bugs in coordinates while scrolling and resizing the window