better handling of selected document resize