added a comment on the reason for the `num_samples - count > 0` check