improved #length testing