fixing resizing code bug