may be it's better to check like ..if(calibrationSamplesCount <=0).. to avoid unexpected behavior?