#52 default value for check is 0.0000001 and added check to avoid count tobe equal to zero