Fix width/height calculation when resizing, closes #12