resolve little bugs for sample count and initialization of boolean variable