Len(var) Condition not evaluating as expected