fixed the problem for resizing