version with correct sample size