Fix crash when width or heigth == 0