Fixed issues when scaling the window.