Fixed a bug in the type checking of collections.