fixed some bugs with resize