fix width/height detection

Change-Id: I46a1a8559eecc81f209e9d9df1762890773d7b03