minor improvements to resize too