fixed some bugs for resizing and modal