Width/Height 0 Fix

Make sure that we only check for height if the width is set to 0 and also we only check for width if the height is set to 0. Otherwise the copyandresize will be executed everytime because the width and height does not match.