Modify function resize, now it can handle n superior to string length