better way of checking for list-like object