Fix bug in resize