Should read:
if width != 0: