Fixed bugs in fitForWidth/Height