better width detection (thanks Stan!)