fix issue where the white space may be lost after window resizing