added collection length checking macro