fixed a bug with window resizing