resize function fix