added length test so length represents the local count of samples