fix bug: maxSize does not work