moved resizing event to resize initially at the right time after rendering