Fixed window resizing bug