fix exception for empty collections