Bug fix in resizing