make sure arg has __len__ before using it