bugfix -- forgot to exclude NA values from length