Fix resize bug