Fixed the resizing bug