check width and height at the same time