fixed bug in resize method