correct resize function