fixed return check due to width and height not always being set when hasWidthOrHeight is checked