fix visual and internal errors when resizing