fix resize function