fix resize logic