Are you considering the window border?
When you resize the window, it's not the same as resizing the Window Frame, you need to compensate the difference between window and window frame.
It should...