Fix window width resize bug