fixed background draw code when resizing the window