Minor fixes to collection-related code