fix resize limit
refactoring