added num samples check