fix bug in resize()