slightly better detection of IEnumerable types
updated with support for custom collection classes