Bugfixes for resizing